id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

Athenian: Conditionalsconditionals2

prev  |  next  |  chance

Check if value is within max_distance units of 0.
By Benji '24

def near(value, max_distance):
    if abs(value) <= max_distance:
        return True
    else:
        return False
Function Call  Return Value
near(2, 3)
near(4, 4)
near(7, 3)
near(-2, 4)
near(-6, 5)
near(0, 0)

Experiment with this code on Gitpod.io

⬅ Back